package com.kim.openapi;

import android.os.Parcel;
import android.os.Parcelable;

public class KimApn implements Parcelable {
    private  String name;
    private  String apn;
    private  String httpProxy;
    private  String httpPort;
    private  String user;
    private  String server;
    private  String password;


    public static class Builder {
        private String name;
        private String apn;
        private String httpProxy;
        private String httpPort;
        private String user;
        private String server;
        private String password;

        public Builder setName(String name) {
            this.name = name;
            return this;
        }

        public Builder setApn(String apn) {
            this.apn = apn;
            return this;
        }

        public Builder setHttpProxy(String httpProxy) {
            this.httpProxy = httpProxy;
            return this;
        }

        public Builder setHttpPort(String httpPort) {
            this.httpPort = httpPort;
            return this;
        }

        public Builder setUser(String user) {
            this.user = user;
            return this;
        }

        public Builder setServer(String server) {
            this.server = server;
            return this;
        }

        public Builder setPassword(String password) {
            this.password = password;
            return this;
        }

        public KimApn createKimAPN() {
            return new KimApn(name, apn, httpProxy, httpPort, user, server, password);
        }
    }


    public static final Creator<KimApn> CREATOR = new Creator<KimApn>() {
        @Override
        public KimApn createFromParcel(Parcel in) {
            return new KimApn(in);
        }

        @Override
        public KimApn[] newArray(int size) {
            return new KimApn[size];
        }
    };

    @Override
    public String toString() {
        return "KimApn{" +
                "name='" + name + '\'' +
                ", apn='" + apn + '\'' +
                ", httpProxy='" + httpProxy + '\'' +
                ", httpPort='" + httpPort + '\'' +
                ", user='" + user + '\'' +
                ", server='" + server + '\'' +
                ", password='" + password + '\'' +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(name);
        dest.writeString(apn);
        dest.writeString(httpProxy);
        dest.writeString(httpPort);
        dest.writeString(user);
        dest.writeString(server);
        dest.writeString(password);
    }

    public String getName() {
        return name;
    }

    public String getApn() {
        return apn;
    }

    public String getHttpProxy() {
        return httpProxy;
    }

    public String getHttpPort() {
        return httpPort;
    }

    public String getUser() {
        return user;
    }

    public String getServer() {
        return server;
    }

    public String getPassword() {
        return password;
    }

    public KimApn(String name, String apn, String httpProxy, String httpPort, String user, String server, String password) {
        this.name = name;
        this.apn = apn;
        this.httpProxy = httpProxy;
        this.httpPort = httpPort;
        this.user = user;
        this.server = server;
        this.password = password;
    }

    protected KimApn(Parcel in) {
        readFromParcel(in);
    }

    public void readFromParcel (Parcel in) {
        name = in.readString();
        apn = in.readString();
        httpProxy = in.readString();
        httpPort = in.readString();
        user = in.readString();
        server = in.readString();
        password = in.readString();
    }

}
